<?php

namespace app\common\controller;

use think\Controller;
use think\captcha\Captcha;
use think\paginator\driver\Bootstrap;

class Common extends Controller{
	public function __construct(){		
		parent::__construct();
		// if (!defined('__ROOT__')) {
		// 	$_root = rtrim(dirname(rtrim($_SERVER['SCRIPT_NAME'], '/')), '/');
		// 	define('__ROOT__', (('/' == $_root || '\\' == $_root) ? '' : $_root));
		// }
		// if (!defined('MODULE_NAME')){define('MODULE_NAME', $this->request->module());}
		// if (!defined('CONTROLLER_NAME')){define('CONTROLLER_NAME', $this->request->controller());}
		// if (!defined('ACTION_NAME')){define('ACTION_NAME', $this->request->action());}

		// if(!is_file(Env::get('runtime_path')."/install.lock")) {	//	进一步检查数据库是否配置



		// }
		

	}
	private function check_db(){
		
	}




	public function _empty() {
		$this->error(lang('operation not valid'));
	}

	protected function verify_build($id){
		ob_end_clean();
		$verify = new Captcha (config('verify'));
		return $verify->entry($id);
	}
	protected function verify_check($id){
		$verify =new Captcha ();
		if (!$verify->check(input('verify'), $id)) {
			$this->error(lang('verifiy incorrect'),url(MODULE_NAME.'/Login/login'));
		}
	}
    protected function check_admin_login(){
		// return false;
		return model('admin/Admin')->is_login();
    }

    /**
    *@param list是一个think\paginator\driver\Bootstrap的实例
    */
    protected function _page($list){
		if($list instanceof BootStrap) {
			
		}
    }
}